﻿<UserControl
    x:Class="TfsWorkbench.ItemListUI.ItemList"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:UIElements="clr-namespace:TfsWorkbench.UIElements;assembly=TfsWorkbench.UIElements" 
    xmlns:Properties="clr-namespace:TfsWorkbench.ItemListUI.Properties" 
    xmlns:PopupControls="clr-namespace:TfsWorkbench.UIElements.PopupControls;assembly=TfsWorkbench.UIElements" 
    x:Name="PART_ItemList" 
    mc:Ignorable="d" d:DesignWidth="435" d:DesignHeight="241">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Resources/GridTemplates.xaml" />
                <ResourceDictionary Source="Resources/GridViewStyle.xaml" />
                <ResourceDictionary Source="/TfsWorkbench.UIElements;Component/Resources/CommandButtonStyles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    
    <DockPanel>
        <Border DockPanel.Dock="Top" CornerRadius="5" Effect="{DynamicResource DropShadowLevel1}" Background="{DynamicResource ToolbarBackground}" Padding="10" Margin="0,4">
            <DockPanel>
                <TextBlock 
					VerticalAlignment="Center" 
					FontWeight="Bold" 
					Margin="5,0,5,0"
                    DockPanel.Dock="Left"
					>
                    <Run Text="Items of type: "/>
                    <TextBlock Text="{Binding Path=WorkbenchItemTypeName, ElementName=PART_ItemList}" FontSize="14" />
                </TextBlock>
                <StackPanel DockPanel.Dock="Right" HorizontalAlignment="Right" Height="25" Orientation="Horizontal">
            		<Button 
            			x:Name="PART_CreateItem"
                        Click="OnCreateItemClick"
            			Style="{DynamicResource AddButtonStyle}" 
            			ToolTip="Add new item"
	                />
            		<Button 
            			x:Name="PART_RefreshAll"
            			Click="RefreshAllClick"
            			Style="{DynamicResource RefreshButtonStyle}" 
            			ToolTip="Refresh / reset all items"
	                />
            		<Button 
            			x:Name="PART_SaveAll"
            			Click="OnSaveAllClick"
            			Style="{DynamicResource SaveButtonStyle}" 
            			ToolTip="Save all items"
	                />
                    <Button
                        Command="{x:Static UIElements:CommandLibrary.SystemShellCommand}"
						CommandTarget="{Binding RelativeSource={RelativeSource Self}}" 
                        CommandParameter="{Binding Source={x:Static Properties:Settings.Default}, Path=HelpPageUrl}"
                        Style="{DynamicResource QuestionButtonStyle}"
                        ToolTip="View the online guidance"
                        />
                    <!--
                    <PopupControls:ValueSelectorControl 
                        Name="PART_StateFilterSelector"
		        		ValueSelections="{Binding ElementName=PART_ItemList, Path=States}" 
		        		ValueSelectionChanged="OnFiltersChanged" 
		        		DisplayText="State Filters" 
		                />
                    -->
                    <PopupControls:ValueSelectorControl 
                        Name="PART_OwnerFilterSelector"
		        		ValueSelections="{Binding ElementName=PART_ItemList, Path=Users}"  
		        		ValueSelectionChanged="OnFiltersChanged" 
		        		DisplayText="Owner Filters" 
                        ShowSelectAll="True"
                        Margin="1,0"
		                />
                </StackPanel>
        	</DockPanel>
        </Border>
        <ListView
            x:Name="PART_MainListView" 
            DockPanel.Dock="Top" 
            ItemsSource="{Binding ControlItemGroups, ElementName=PART_ItemList}" 
            Style="{StaticResource ListViewStyle1}" 
            GridViewColumnHeader.Click="GridViewColumnHeaderClickedHandler"
            MouseDoubleClick="OnMainListViewOnMouseDoubleClick"
            PreviewMouseLeftButtonDown="OnMainListViewPreviewMouseLeftButtonDown"
            >
            <ListView.View>
                <GridView x:Name="PART_MainGridView" />
            </ListView.View>
        </ListView>            
    </DockPanel>
</UserControl>
